package insight.google.game.era.bo;

import javax.jdo.annotations.FetchGroup;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable(identityType = IdentityType.APPLICATION,detachable="true")
@FetchGroup(name = "taskList", members = { @Persistent(name = "currentRoom")})
public class Task {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key taskId;

    @Persistent
	private String orgUserName;
	@Persistent
	private String targetUserName;
	@Persistent
	private String orgCardId;
	@Persistent
	private String matchCardValue;
	
	@Persistent(mappedBy ="taskList")
	private GameRoom currentRoom;
	
	public Task(GameRoom room, String orgUserId, String targetUserId, String orgCardId, String matchCardValue){
		this.currentRoom = room;
		this.orgUserName = orgUserId;
		this.targetUserName = targetUserId;
		this.orgCardId = orgCardId;
		this.matchCardValue = matchCardValue;
	}

	public String getOrgUserName() {
		return orgUserName;
	}

	public void setOrgUserName(String orgUserName) {
		this.orgUserName = orgUserName;
	}

	public String getTargetUserName() {
		return targetUserName;
	}

	public void setTargetUserName(String targetUserName) {
		this.targetUserName = targetUserName;
	}

	public String getOrgCardId() {
		return orgCardId;
	}

	public void setOrgCardId(String orgCardId) {
		this.orgCardId = orgCardId;
	}

	public String getMatchCardValue() {
		return matchCardValue;
	}

	public void setMatchCardValue(String matchCardValue) {
		this.matchCardValue = matchCardValue;
	}

	public GameRoom getCurrentRoom() {
		return currentRoom;
	}

	public void setCurrentRoom(GameRoom currentRoom) {
		this.currentRoom = currentRoom;
	}

	public Key getTaskId() {
		return taskId;
	}

	public void setTaskId(Key taskId) {
		this.taskId = taskId;
	}

	public String toString() {
		return KeyFactory.keyToString(taskId);
	}
}
